var app = getApp()
Page({
  data: {
    title:'',
    hairdressers:[]
  },
  subscribe: function (e) {
  
    wx.navigateTo({ 
      url: "/pages/subscribe/subscribe?itemId=" + e.currentTarget.dataset.item_id + "&hairdresser_id=" + e.currentTarget.id
    });

  },


  onLoad: function (e) {
    var that = this
   
    wx.request({
      url: app.globalData.api_url + "index.php?ac=mfapi&ts=serv_get_data" ,
      data: { item_id: e.itemId},
      method:"GET",
      header: { 'content-type': 'application/json'},
      success:function(res){
        wx.setNavigationBarTitle({ title: res.data.item_name})
      }
    }),

      wx.request({
      //url: app.globalData.api_url + "hairdresser/service",
      url: app.globalData.api_url + "index.php?ac=mfapi&ts=hairdresser_get_item_all",
        data: { item_id: e.itemId },
        method: "GET",
        header: { 'content-type': 'application/json' },
        success: function (res) {
        
          if (res.data.length<1)
          {
            
            wx.showToast({
              title:'暂无内容',
              icon:'loading',
              duration:5000,
              complete:function(){
                wx.navigateBack();
              }
            });
            
           return;
          }
          that.setData({           
            hairdressers  : res.data
          });
          wx.hideLoading();
          
          
        }
      }),
      
    setTimeout(function () {
        wx.hideLoading()
      }, 2000)
    
   
   
  }
})